<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    const obj = {
      name: 'zs',
      age: 12,
      sex: 'man'
    }
    const arr = []
    for(let k in obj) {
      console.log(k + '---' + obj[k]);
      arr.push(k)
    }
    console.log(arr);
    console.log('---------');
    // 需求将所有对象的key/值收集到一个数组中
    console.log(Object.keys(obj).sort());
    console.log(Object.values(obj));
  </script>
</body>
</html>